//
//  MainKBViewCHeadView.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 2017/3/20.
//  Copyright © 2017年 可为. All rights reserved.
//

#import "MainKBViewCHeadView.h"
#import "Masonry.h"
#import "UIColor+CL.h"

@implementation MainKBViewCHeadView
-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createUI];
    }
    
    return self;
}
-(instancetype)init{
    self = [super init];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self createUI];
    }
    return self;
}
-(void)createUI{
    
    UIView *baseView = [[UIView alloc]init];
    [self addSubview:baseView];
    
    UIImageView *backGroundColorImg = [[UIImageView alloc]init];
    [baseView addSubview:backGroundColorImg];
    [backGroundColorImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(baseView.mas_left);
        make.right.equalTo(baseView.mas_right);
        make.top.equalTo(baseView.mas_top);
        make.height.equalTo(@((10/2) - 1));
    }];
    
    UIImageView *backTopLineImg = [[UIImageView alloc]init];
    [baseView addSubview:backTopLineImg];
    [backTopLineImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(backGroundColorImg.mas_left);
        make.right.equalTo(backGroundColorImg.mas_right);
        make.top.equalTo(backGroundColorImg.mas_bottom);
        make.height.equalTo(@(1));
    }];

    UIImageView *backBottomLineImg = [[UIImageView alloc]init];
    [baseView addSubview:backBottomLineImg];
    [backBottomLineImg mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(backGroundColorImg.mas_left).offset(36/2);
//        make.right.equalTo(backGroundColorImg.mas_right).offset(-36/2);
        make.left.equalTo(backGroundColorImg.mas_left);
        make.right.equalTo(backGroundColorImg.mas_right);
        make.bottom.equalTo(baseView.mas_bottom);
        make.height.equalTo(@(1));
    }];
    UIImageView *ingView = [[UIImageView alloc]init];
    [baseView addSubview:ingView];
    [ingView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(baseView.mas_left).offset(36/2);
        make.width.equalTo(@(8/2));
        make.centerY.equalTo(baseView.mas_centerY);
        make.height.equalTo(@(40/2));
    }];
    _labelLeft = [[UILabel alloc]init];
    [baseView addSubview:_labelLeft];
    [_labelLeft mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(ingView.mas_right).offset(18/2);
        make.right.equalTo(baseView.mas_centerX);
        make.centerY.equalTo(ingView.mas_centerY);
//        make.height.equalTo(self.mas_height).offset(-10/2);
    }];
    
    
    _labelRight = [[UILabel alloc]init];
    [baseView addSubview:_labelRight];
    
    [_labelRight mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.mas_centerX);
        make.right.equalTo(baseView.mas_right).offset(-36/2);
        make.centerY.equalTo(_labelLeft.mas_centerY);
        make.height.equalTo(_labelLeft.mas_height);
    }];
    
    [baseView mas_makeConstraints:^(MASConstraintMaker *make) {
        //        make.left.equalTo(self.mas_centerX);
        make.right.equalTo(self.mas_right);
        make.left.equalTo(self.mas_left);
        make.bottom.equalTo(self.mas_bottom);
        make.top.equalTo(self.mas_top);
    }];
    
    
    backGroundColorImg.backgroundColor = [UIColor colorWithHex:0xf5f8fa];
    backTopLineImg.backgroundColor = [UIColor colorWithHex:0xe3eaef];
    backBottomLineImg.backgroundColor = [UIColor colorWithHex:0xe3eaef];

    ingView.backgroundColor = [UIColor colorWithHex:0x59a7fe];
    
    _labelLeft.font = [UIFont systemFontOfSize:30/2];
    _labelLeft.textColor = [UIColor colorWithHex:0x343434];
    _labelRight.font = [UIFont systemFontOfSize:30/2];
    _labelRight.textColor = [UIColor colorWithHex:0x858585];

    _labelLeft.backgroundColor = [UIColor whiteColor];
    
    baseView.backgroundColor = [UIColor whiteColor];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
